package com.qf.main.pharmacy.controller;

import com.github.pagehelper.PageInfo;
import com.qf.common.base.result.ResponseResult;
import com.qf.main.pharmacy.common.qo.DeliveryQo;
import com.qf.main.pharmacy.common.qo.StorageQo;
import com.qf.main.pharmacy.common.vo.DeliveryVo;
import com.qf.main.pharmacy.common.vo.StorageVo;
import com.qf.main.pharmacy.entity.Delivery;
import com.qf.main.pharmacy.mapper.DeliveryMapper;
import com.qf.main.pharmacy.service.DeliveryService;
import com.qf.main.pharmacy.service.StorageService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author chengqiang
 * @Create 2024-03-03-23:36
 * @Description:
 */
@RestController
@RequestMapping("/delivery")
@CrossOrigin
@Api(tags = "出库管理")
public class DeliveryController {

    @Resource
    private DeliveryService deliveryService;

    @GetMapping("/list")
    public ResponseResult<PageInfo<DeliveryVo>> auditList(@RequestParam(value = "pageNum" ,required = false) Integer pageNum,
                                                         @RequestParam(value = "pageSize" ,required = false) Integer pageSize,
                                                         @RequestParam(value = "deliveryNo",required = false)String deliveryNo){

        return  ResponseResult.success(deliveryService.deliveryList(pageNum,pageSize, deliveryNo));
    }


    @PostMapping("/save")
    public ResponseResult<Integer> saveAudit(@RequestBody DeliveryQo deliveryQo){
        return ResponseResult.success(deliveryService.saveDelivery(deliveryQo));
    }
    @PostMapping("/edit")
    public ResponseResult<Integer> editAudit(@RequestBody StorageQo storageQo){
        return ResponseResult.success(deliveryService.modifyDelivery(storageQo));
    }
}
